#include <stdio.h>
#include "string_manage.h"

const char* data = "GPS:{$GPRMC,080655.00,A,4546.40891,N,12639.65641,E,1.045,328.42,170809,,,A*60}";

int main() 
{
    int cnt = 0;
	
	/*
		若使用了其他的内存管理函数，则通过string_memory_hooks_init函数进行注册
		只需定义str_mem_hooks 类型的变量
    */
	//str_mem_hooks hooks = {malloc, free, realloc};
    //string_memory_hooks_init(&hooks);		
    
    char* result = extract_string(data, '{', '}');

    if (result) 
    {
        printf("%s\n", result);

        char** strs = split_string(result, ",", &cnt);
        if (strs != NULL) 
        {
            for (int i = 0; i < cnt; i++) 
            {
                printf("%s\n", strs[i]);
            }
            free_split_string(strs, cnt);
        }
        free_extract_string(result);
    }
    else 
    {
        printf("No Find\\n");
    }
    return 0;
}



